package com.ayu.scalalearn.chapter06

/**
  * @Author
  * @Description Test13TraitSelfType
  * @Date 2022/8/2 14:00
  * @Version 1.0
  */
object Test13TraitSelfType {

  def main(args: Array[String]): Unit = {

    var userRegister = new RegisterUser("ayu",18)

    userRegister.insert()
  }

}

class User(var name: String, var age: Int)

trait UserDao {
  //定义自身类型
  _: User =>
  def insert(): Unit = {
    println("插入一条用户数据：" + this.name + "_" + this.age)
  }
}
class RegisterUser(name: String, age: Int) extends User(name: String, age: Int) with UserDao {


}
